package com.example.recruit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.recruit.dto.JobAll;
import com.example.recruit.dto.JobDetail;
import com.example.recruit.entity.Job;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface JobMapper extends BaseMapper<Job> {
    @Select("SELECT job.id,job.name,employer.name as boss_name,company.company_name,job.labels,job.skill,job.galary,job.welfare,job.category\n" +
            " from employer,job,company WHERE employer.id= #{bossId} AND job.boss_id=#{bossId} And company.id=#{companyId} AND job.id=#{jobId}")
    JobAll getJobAllListByBossId(String bossId,String companyId,String jobId);
    
    @Select("SELECT job.id,employer.NAME AS employer_name,employer.phone ,employer.avatar,job.skill,job.name AS job_name,job.labels,job.galary,job.welfare,job.category,job.status,company.company_name,company.address,company.image,company.count \n" +
            "FROM employer,job,company WHERE job.id = #{jobId} AND job.boss_id = employer.id AND job.company_id = company.id")
    JobDetail getJobDetailByJobId(String jobId);
}
